package com.blog.study.study5;

import java.util.Date;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ScheduledThreadPoolExecutor;

/**
 * 有关Timer定时器的使用.
 *
 * @author 张俊强~.
 * @date 2017/11/23-21:27.
 */
public class TimerProgram {

    public static void main(String[] args) {

        System.out.println("E:\\IDEAProject\\SGM-DREAMS-WORKSPACE\\target\\DREAMSITOWSP\\");

        Timer timer = new Timer();
        TimerTask timerTask = new TimerTask() {
            @Override
            public void run() {
                System.out.println("RUN");
            }
        };
        timer.schedule(timerTask, 2000, 5000);
        System.out.println(new Date());
        System.out.println(new Date(timerTask.scheduledExecutionTime()));

        ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(1);
//        Set<Integer> ints = Set.of(1, 2, 3);

    }
}
